-- power_resonance
-- created by wangy
-- 威力共鸣属性（同类越多威力增加越多）

return {
    apply = function(prop, baseValue)
        return baseValue;
    end,

    -- 每回合触发
    trigger = function(who, prop, base)
        local count = 0;
        local layer = DungeonM.currentLayer();
        for pos = 1, GRID_SIZE do
            local grid = DungeonM.getGridByPos(pos);
            local monster = grid.monster;

            -- 如果还未翻开，或者不是怪物，或者不是同类，或者已经死亡
            if  grid:isOpened() and grid:isMonster() and
                monster and monster:query("base_class_id") == who:query("base_class_id") and
                not monster:isDead() and monster ~= who then
                count = count + 1;
            end
        end

        return tonumber(base) + count * prop[3];
    end,

    record = function(target, prop, path)
        return false;
    end
};